<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<LINK href="img_files/pop.css" type=text/css rel=stylesheet>
<STYLE type=text/css>
BODY {
	FONT: 9pt "宋体", Verdana, Arial, Helvetica, sans-serif
}
A {
	FONT: 9pt "宋体", Verdana, Arial, Helvetica, sans-serif
}
TABLE {
	FONT: 9pt "宋体", Verdana, Arial, Helvetica, sans-serif
}
DIV {
	FONT: 9pt "宋体", Verdana, Arial, Helvetica, sans-serif
}
SPAN {
	FONT: 9pt "宋体", Verdana, Arial, Helvetica, sans-serif
}
TD {
	FONT: 9pt "宋体", Verdana, Arial, Helvetica, sans-serif
}
TH {
	FONT: 9pt "宋体", Verdana, Arial, Helvetica, sans-serif
}
INPUT {
	FONT: 9pt "宋体", Verdana, Arial, Helvetica, sans-serif
}
SELECT {
	FONT: 9pt "宋体", Verdana, Arial, Helvetica, sans-serif
}
BODY {
	PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; PADDING-TOP: 5px
}
.STYLE1 {color: #FFFFFF}
</STYLE>
<script src="../../inc/common.js"></script>
<script src="../../js/jquery.js"></script>
<SCRIPT language=JavaScript>
var parentWin;
var ctlType;
var mode;
var editObj;

function ok() {
	if (ctlName.value=="") {
		alert("请填写标识！");
		return;
	}
	if (ctlTitle.value=="") {
		alert("请填写名称！");
		return;
	}

	var opts = "";
	var v;
	for (var i=0; i<20; i++) {
		v = o("option" + i).value;
		if (v=="")
			continue;
		if (v==defaultValue.value)
			opts += '<option value="' + v + '" selected>' + v + '</option>';
		else
			opts += '<option value="' + v + '">' + v + '</option>';
	}
	if (mode=="create")
		parentWin.CreateSelectCtl(ctlType, ctlName.value, ctlTitle.value, opts, fieldType.value, canNull.value, minT.value,minV.value,maxT.value,maxV.value);
	else {
		if (editObj.size==0 || editObj.size==1)
			ctlType = "select";
		else
			ctlType = "list";

		if (isIE11) {
			// ie11下，如下两种方式无法删除
		    // editObj.parentNode.removeChild(editObj);
			// $(editObj).remove();
			
			if (parentWin.IframeID.getSelection) {
				if (parentWin.IframeID.getSelection().rangeCount > 0) {
					var oControlRange = parentWin.IframeID.getSelection().getRangeAt(0);
					oControlRange.extractContents();
				}
			}
			parentWin.CreateSelectCtl(ctlType, ctlName.value, ctlTitle.value, opts, fieldType.value, canNull.value, minT.value,minV.value,maxT.value,maxV.value);
		}
		else {
			editObj.outerHTML = "";
			parentWin.CreateSelectCtl(ctlType, ctlName.value, ctlTitle.value, opts, fieldType.value, canNull.value, minT.value,minV.value,maxT.value,maxV.value);
		}
	}
		
	window.close();
}

function window_onload() {
	parentWin =	dialogArguments[0];
	mode = dialogArguments[1];
	if (mode=="create")
		ctlType = dialogArguments[2];
	else {
		editObj = dialogArguments[2];
		ctlName.value = editObj.name;
		ctlTitle.value = editObj.title;
		defaultValue.value = editObj.value;
		fieldType.value = (editObj.fieldType==null)?"0":editObj.fieldType;
		
		fieldType.disabled = true;
		ctlName.disabled = true;
		
		var opts = editObj.options;
		for (var i=0; i<opts.length; i++) {
			o("option" + i).value = opts.item(i).value;
		}
		
		canNull.value = (editObj.getAttribute("canNull")==null)?"1":editObj.getAttribute("canNull");
		minT.value = (editObj.getAttribute("minT")==null)?"d=":editObj.getAttribute("minT");
		minV.value = (editObj.getAttribute("minV")==null)?"":editObj.getAttribute("minV");
		maxT.value = (editObj.getAttribute("maxT")==null)?"x=":editObj.getAttribute("maxT");
		maxV.value = (editObj.getAttribute("maxV")==null)?"":editObj.getAttribute("maxV");
	}
}
</SCRIPT>
</HEAD>
<BODY bgColor=menu onLoad="window_onload()">
<TABLE width="293" border=0 align=center cellPadding=0 cellSpacing=0>
  <TBODY>
  
  <TR>
    <TD height="28" align=center>控件字段：</TD>
    <TD height="28" align=left><input name="ctlName" type="text" style="width: 150px; height:22px" maxlength="30">
      <input name="submit2" type=button id=submit onClick=ok() value=确定></TD>
  </TR>
  <TR>
<TD width="86" height="28" align=center>控件名称：</TD>
<TD width="207" height="28" align=left><input type="text" name="ctlTitle" style="width: 150px; height:22px"></TD>
  </TR>
  
  <TR>
    <TD width="86" height="28" align=center>默&nbsp;认&nbsp;值：</TD>
    <TD width="207" height="28" align=left><input type="text" id="defaultValue" name="defaultValue" style="width: 200px; height:22px"></TD>
  </TR>
  <TR>
    <TD height="28" align=center>数据类型：</TD>
    <TD height="28" align=left>
      <select id="fieldType" name="fieldType">
        <option value="0">字符串型</option>
        <option value="1">文本型</option>
        <option value="2">整型</option>
        <option value="3">长整型</option>
        <option value="4">布尔型</option>
        <option value="5">浮点型</option>
        <option value="6">双精度型</option>
        <option value="7">日期型</option>
        <option value="8">日期时间型</option>
        <option value="9">价格型</option>
      </select>
    </TD>
  </TR>
  <TR>
    <TD height="28" colspan="2" align=center><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <TR>
        <TD height="28" align=center>必&nbsp;填&nbsp;项：</TD>
        <TD height="28" align=left><select id="canNull" name="canNull">
            <option value="1">否</option>
            <option value="0">是</option>
          </select>
        </TD>
      </TR>
      <TR>
        <TD height="28" align=center> 长度/大小：</TD>
        <TD height="28" align=left><select name="minT">
            <option value="d=">>=</option>
            <option value="d">></option>
            <option value="=">=</option>
          </select>
            <input name="minV" style="width:40px">
            <select name="maxT">
              <option value="x="><=</option>
              <option value="x"><</option>
            </select>
            <input name="maxV" style="width:40px"></TD>
      </TR>
      <tr>
        <td width="30%" height="28" align="center" bgcolor="#999999"><span class="STYLE1">序号</span></td>
        <td width="70%" bgcolor="#999999"><span class="STYLE1">菜单项目</span></td>
      </tr>
	  <script>
	  for (var k=0; k<20; k++) {
      	document.write("<tr>");
        document.write('<td height="28" align="center">' + k + '</td>');
        document.write('<td><input type="text" name="option' + k +'" style="width: 200px; height:22px"></td>');
        document.write('</tr>');
	  }
	  </script>

      
    </table></TD>
  </TR>
</TBODY></TABLE>
</BODY></HTML>
